package im.oen.boot.api.dispatch.data;

import im.oen.boot.api.dispatch.MethodHandlerExecutor;
import im.oen.boot.common.utils.Checker;

/**
 * @author Kevin.Xu
 */
public class UriData {

    private String className;
    private String methodName;
    private String[] params;
    private MethodHandlerExecutor executor;

    public UriData() {
    }

    public UriData(String className, String methodName, MethodHandlerExecutor executor, String[] params) {
        this.className = className;
        this.methodName = methodName;
        this.executor = executor;
        this.params = params;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public String[] getParams() {
        return params;
    }

    public void setParams(String[] params) {
        this.params = params;
    }

    public MethodHandlerExecutor getExecutor() {
        return executor;
    }

    public void setExecutor(MethodHandlerExecutor executor) {
        this.executor = executor;
    }

    public boolean isEmpty() {
        return Checker.hasEmpty(className, methodName, executor);
    }

    public Object exec(String body) {
        return this.executor.exec(this.methodName, this.params, body);
    }
}
